// service  统一出口
import MYRequest from './request';
import { BASE_URL, TIME_OUT } from './request/config';

const myRequest = new MYRequest({
  baseURL: BASE_URL,
  timeout: TIME_OUT,
  _interceptors: {
    requestInterceptor: (config) => {
      return config;
    },
    requestInterceptorCatch: (err) => {
      return err;
    },
    responseInterceptor: (res) => {
      return res.data;
    },
    responseInterceptorCatch: (err) => {
      // 可以根据错误码显示不同的错误信息
      return err;
    }
  }
});

export default myRequest;
